<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>业务移交</title>
<jsp:include page="../../import.jsp" flush="true" />
<style>
.inputCss{
-moz-border-radius:5px;
          -webkit-border-radius:5px;
          -ms-border-radius:5px;
          -khtml-border-radius:5px;
           border-radius:5px;
}
</style>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <table class="layout2col1">
        <tbody>
            <tr >
               
                <td width="100%" valign="top">
                    <div class="sqPanel">
                        <div class="sqPanel_head">
                            <span><i class="sqIco sqIco_4"></i>任务交接</span>
                        </div>
                        <div class="sqPanel_body">
                        	<div class="btnsBox">
                        	<div style="width:60px;float:left">原处理人:</div>
                			<div style="width:150px;float:left">
                				<input name="owner" id="ownerId" class="ui-textbox" type="text"  value="" style="display:none;">
                    			<input name="ownerName" id="ownerName" class="ui-textbox" type="text" placeholder="--请选择--" value="">
                			</div>
                			<div style="width:60px;float:left">新处理人:</div>
                			<div style="width:150px;float:left">
                				<input name="assigneeId" id="assigneeId" class="ui-textbox" type="text"  value="" style="display:none;">
                    			<input name="assigneeName" id="assigneeName" class="ui-textbox" type="text" placeholder="--请选择--" value="">
                			</div>
                            <span class="sq-button sq-button-hasicon" style="float:right;margin-right:25px" id="saveChange_btn"><i class="sqBtnIco_10"></i>确   定</span>
                            </div>
                            <br/>
                        </div>
                    </div>
                </td>
            </tr>
            <!-- 隐藏客户ID, 提供给客户管理中 项目列表使用 -->
			<div class="fieldBox col_100" style="display:none;">
		       <div class="field">
		        	<input name="projectId" id="projectId" type="text" class="ui-textbox" value="${prjId}">
		       </div>
		    </div>
        </tbody>
    </table>
</div>

<script type="text/javascript">
	var grid = null;
	var tree;
	$(function () {
    // 单击事件
    $("#ownerName").click(function(){
    	 var type = "owner" ;
    	 $.ligerDialog.open({  title: '组织架构',height: 550,width: 950, url:'<%=path%>/project/prjbscinfo/sysOrg.do?type='+type});
	});
    $("#assigneeName").click(function(){
    	var type = "assignee" ;
    	$.ligerDialog.open({  title: '组织架构',height: 550,width: 950, url:'<%=path%>/project/prjbscinfo/sysOrg.do?type='+type});
  	});
  	//修改中的保存按钮
     $("#saveChange_btn").click(function(){
    	var ownerId = $("#ownerId").val();
    	var assigneeId = $("#assigneeId").val();
    	var assigneeName = $("#assigneeName").val();
    	if(ownerId.length==0){
    		 $.ligerDialog.SQalert({content:"原处理人不能为空!", SQ_type: "warning"});
    		 return;
    	}
    	if(assigneeId.length==0){
   			 $.ligerDialog.SQalert({content:"新处理人不能为空!", SQ_type: "warning"});
   			return;
 	  	}
    	if(assigneeId==ownerId){
  			 $.ligerDialog.SQalert({content:"新处理人不能与原处理人为同一个人!", width: 400,SQ_type: "warning"});
  			return;
	  	}
  	    $.ajax({
  			type: 'post',
  			dataType:'json',
  			data:{
  				"ownerId":ownerId,
  				"assigneeId":assigneeId,
  				"assigneeName":assigneeName
  			},
  			url: '<%=path%>/project/prjbscinfo/saveTaskTransfer.do',
				success : function(msg) {
					if (msg.success == 1) {
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
						parent.$.ligerDialog.close();
						parent.$(".l-dialog,.l-window-mask").css("display","none"); 
					} else {
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				}
			});
		});

		function setExpand2Parents(nodeid, treeid) {
			var tree = liger.get("tree1");
			var parent = tree.getParent(tree.getDataByID(nodeid));
			if (parent != null) {
				parent.isExpand = true;
				setExpand2Parents(parent.id);
			} else {
				tree.setData(tree.getData());
				console.log(tree.getData());
			}
			;
		}
	});
</script>
</body>
</html>